package com.asnike.selector{
	import com.greensock.TweenMax;
	
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	public class SaveSelector extends BasicSelector{
		
		public var btnSend:Sprite;
		public var btnShare:Sprite;
		public var completePopup:Sprite;
		
		private var _completeCallback:Function;
		
		public function SaveSelector(){
			initEvent();
			initPopup();
		}
		private function initEvent():void{
			btnSend.buttonMode = true;
			btnShare.buttonMode = true;
			btnSend.addEventListener( MouseEvent.CLICK, clickBtnbtnSend );
			btnShare.addEventListener( MouseEvent.CLICK, clickBtnShare );
		}
		private function clickBtnbtnSend( $e:MouseEvent ):void{
			showPopup();
		}
		private function clickBtnShare( $e:MouseEvent ):void{
			showPopup();
		}
		private function initPopup():void{
			completePopup.visible = false;
		}
		private function showPopup():void{
			completePopup.visible = true;
			completePopup.y = 274;
			completePopup.alpha = 0;
			TweenMax.to( completePopup, .4, {y:294, alpha:1, onComplete:function():void{
				if( _completeCallback is Function ){
					_completeCallback();
				}
			}} );
		}
		
		public function show():void{
			visible = true;
		}
		public function hide():void{
			visible = false;
		}
		
		public function setCompleteCallback( $function:Function ):void{
			_completeCallback = $function;
		}
	}
}